package com.ymatou.iapi.prodstock.service;

import com.google.common.reflect.TypeToken;
import com.ymatou.iapi.prodstock.parameter.FreezeProductResult;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;

import java.util.List;
/**
*解冻库存Call
*FreeMaker Template自动生成代码
*/
public class UnfreezeAllocateStockCall extends YmatouBaseCall{
	private static String opurl ="api/Allocate/UnfreezeAllocateStock";
	
	public UnfreezeAllocateStockCall() {
		super(EnvSetup.getSystemUrl("prodstock"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public List<FreezeProductResult> getResults(){
		String sResults=getJsonObject().get("Data").getAsJsonObject().get("Results").getAsJsonArray().toString();
		List<FreezeProductResult> FreezeProductResultList=(List<FreezeProductResult>)FormatUtil.GSONToObject(sResults, new TypeToken<List<FreezeProductResult>>(){}.getType());
		return FreezeProductResultList;
	}
}